package com.xonro.common.histrans.sfeg.job.base;

import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.xonro.common.histrans.base.consts.SfegConst;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.List;

public class UserTransJob implements IJob {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        SDK.getLogAPI().consoleInfo("r人员信息同步开始==============");
        List<RowMap> maps = SDK.getCCAPI().getRDSAPI(SfegConst.CCID).getMaps("SELECT * FROM Tb_UserInfo ");
        SDK.getLogAPI().consoleInfo("r人员信息条数=============="+maps.size());
        for (RowMap m : maps) {
            int user = SDK.getORGAPI().createUser("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe", m.getString("loginName"), m.getString("usName"), "d102c89d-55f3-4865-9d5c-c00b7f47b803", "123456", false);
        }
        for (RowMap m : maps) {
            DBSql.update("UPDATE ORGUSER SET USERNO='"+m.getString("gh")+"' WHERE USERID='"+ m.getString("loginName")+"'");
        }
        SDK.getLogAPI().consoleInfo("r人员信息同步结束==============");
    }
}
